﻿namespace Leetcode.N0204;

public class Solution
{
    public int CountPrimes(int n)
    {
        int count = 0;
        for (int i = 2; i < n; i++)
        {
            if (IsPrime(i))
            {
                count++;
            }
        }
        return count;

    }

    bool IsPrime(int x)
    {
        for (int i = 2; i * i <= x; ++i)
        {
            if (x % i == 0)
            {
                return false;
            }
        }
        return true;
    }
}
